home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMIBEST4.ADF
/
WorkbenchStuff
/
IconExec.DOC
< prev
next >
Wrap
Text File
|
1987-07-22
|
6KB
|
121 lines
/* (c) Copyright 1986 John A. Toebes, VIII All rights reserved */
/* 120-H Northington Place, Cary NC 27511 (919) 469-4210 */
/* This program may be used and modified for any purpose so long as */
/* this copyright notice remains with the code and the program is not */
/* sold and no charge is made for its use. */
Date-Received: 22 Feb 86 06:37:26 GMT
Sender: jcz@ncsu.UUCP
Organization: SAS Institute Inc.
Here are two simple utilities that may make it easier to write code that
runs from workbench. The second utility IconExec allows you to run any
arbitrary command from an Icon WITHOUT having to recompile a program
everytime you wish to change what is run. The other utility allows you to
set the default window that will be used when an Icon is selected.
As a matter of short explaination, whenever an Icon is selected, the
ToolWindow field is (supposed to be) copied into the initial startup
message that is passed to your program. The startup code (c.o) looks at
that message and opens up that window by default. In this way you can
always associate a window with a program without having to open it in your
code. Unfortunately, Intuition (or whomever is responsible) fails to copy
the ToolWindow field over and no window is opened currently. ICONEXEC
takes that into account and opens up the window anyway (Until the parameter
gets copied correctly in a later OS release) and sets it as the default
window.
Once a window is established, the commands that are contained in the
ToolTypes arrays are then executed one at a time. More detailed
information about how the Icons are organizied is in Chapter 4 of Volume1
in the 1.1 Rom Kernal Manual, although the information is not critical to
using the program. If enough interest exists, I will create a tutorial on
using Icons or whatever other information is desired in creating/accessing
them from a program.
These programs were created in response to a request for being able to run
programs such as MUSICRAFT which have no ICONS without Having to modify the
program. If you plan on using ICONEXEC for a commercial product, just
contact me first.
AltIcon
In making some enhancements to the Icons for Hack, I wrote a very simple
utility that you may find useful. Normally, the Icon editor only lets you
create icons whose selected action is either to reverse the image or
provide backfill.However, in the gadget structure for the Icon is the
ability to put an alternate image as found in any gadget. To use it you
simply have to supply an alternate image and set the appropriate bits in
the structure.
Unfortunately ICONED fails to provide an easy way to do this so I wrote a
Q&D tool to combine two icons into a single one with the second being an
alternate image for the first.
To use it, first compile the program (It works under Lattice, have no idea
about MANX) and link it.
Then create two icons for the one you want. Make the first the normal
image and the second the alternate image. When saving them make sure you
set the frame the same for both or the results will be an alternate image
slightly out of wack (and I don't mean the debugger) with the first. Lets
assume the first is called 'primary' and the second 'alternate'. At this
point there will be four files on disk:
primary
primary.info
secondary
secondary.info
Now run the SetAlternate (AltIcon) program with
SetAlternate primary secondary
The primary icon will now display the second one when you hit on it. Note
that since the image was copied, you can delete the second one ('secondary'
in this case) without any effect. Note however that ICONED does not know
exactly what to do with the alternate image so you lose it if you edit the
Icon. Have no fear, just run the program again to reset the alternate.
Also there are no side effects from running SetAlternate over and over on
the same icons (other than waste time).
IconExec
/* ICONEXEC (c) Copyright 1986 John A. Toebes, VIII. All rights reserved */
/* This program may be used and modified for any purpose so long as */
/* this copyright notice remains with the code and the program is not */
/* sold and no charge is made for its use. For permission to */
/* incorporate this into a commercial product, contact the author: */
/* John A. Toebes, VIII */
/* 120 H Northington Place */
/* Cary NC 27511 */
/* (919) 469-4210 */
This program allows you to associate any series of CLI commands to be run
when you click on an ICON even though there is no CLI window open One
problem associated with it is that a program that does input from the
default input (*) always sees EOF. I am researching why this happens, but
believe it is related to an AmigaDos problem.
To create and execute a user customized Icon Exec
1) Create an Icon (copy the CLI Icon) for IconExec
2) Run the SetWindow program to set a the tool window on the Icon
SETWINDOW ICONEXEC "CON:0/0/100/100/MYWINDOW"
If you do not do this, then by default ICONEXEC will open a full
screen window with a title of "ICONEXEC by John A. Toebes, VIII"
3) Using the Workbench INFO meno option, enter the commands into the
tool types window.
4) Click on the Icon and watch it go.
Subject: ICONEXEC utility